From c0e326d75a32765560a4cbfdb6ce6050afad2a18 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Apr 2018 18:53:12 +0300 Subject: [PATCH] Simplify --- src/cargo/util/rustc.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cargo/util/rustc.rs b/src/cargo/util/rustc.rs index 53f74e130..25bb9b5ba 100644 --- a/src/cargo/util/rustc.rs +++ b/src/cargo/util/rustc.rs @@ -186,15 +186,15 @@ impl Cache { impl Drop for Cache { fn drop(&mut self) { - match (&self.cache_location, self.dirty) { - (&Some(ref path), true) => { - let json = serde_json::to_string(&self.data).unwrap(); - match paths::write(path, json.as_bytes()) { - Ok(()) => info!("updated rustc info cache"), - Err(e) => warn!("failed to update rustc info cache: {}", e), - } + if !self.dirty { + return; + } + if let Some(ref path) = self.cache_location { + let json = serde_json::to_string(&self.data).unwrap(); + match paths::write(path, json.as_bytes()) { + Ok(()) => info!("updated rustc info cache"), + Err(e) => warn!("failed to update rustc info cache: {}", e), } - _ => (), } } } -- 2.30.2